package com.rrym.basedata.service;

import com.rrym.basedata.entity.TestPO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * @Author xiao
 * @Description:
 * @Date 2020/8/21 7:55 下午
 */
@Service
public class TestServiceImpl implements TestService {

    @Autowired
    RedisTemplate<String,Object> redisTemplate;

    @Override
    public void addPO(TestPO po) {
        redisTemplate.opsForList().leftPush("testPO",po);
    }

    @Override
    public List<Object> getPO() {
        List<Object> list=  redisTemplate.opsForList().range("testPO", 0, -1); // 获取所有的

        return list;
    }
}
